package com.bnq.logc.tmp

import com.bnq.logc.Logc
import com.bnq.logc.config.LogcConfig
import com.bnq.logc.upload.UploadFileManager
import com.bnq.logc.utils.DateUtil
import com.bnq.logc.utils.ExecutorUtil.Task

class TmpFileUploadTask(val config: LogcConfig.TmpScheduleUploadFileConfig) : Task() {
    override fun execute() {
        val key = System.currentTimeMillis().toString()
        Logc.i("TmpUploadWorker",">>>> TmpFileUploadTask -> execute start key:$key, ${DateUtil.currentDateTimeString()}")
        UploadFileManager.checkAndUploadTmpFile(config.file,config.cloudPathName){checkUploadResult->
            Logc.i("TmpUploadWorker","<<<< TmpFileUploadTask -> execute end key:$key, ${DateUtil.currentDateTimeString()}, uploadResult:${checkUploadResult.getUploadSuccessRateString()}, e: ${checkUploadResult.e}, uploadError: ${checkUploadResult.getSimpleUploadErrorInfoString()}")
        }
    }
}